<template>
    <div>
        <div v-if="!isRead" class="edu-opertion-bar">
            <div class="float-left"/>
            <div class="float-right">
                <el-button
                    v-if="dataType === '1'"
                    type="primary"
                    @click="addCourseCategory"
                >{{ $t('common.btn.add') }}</el-button>
            </div>
        </div>
        <div v-if="next" class="tip-message">{{ tip }}</div>
        <el-col :span="24">
            <div class="target-table-container">
                <div
                    data-v-9f0440ee
                    class="el-table el-table--fit el-table--border el-table--enable-row-hover el-table--mini"
                >
                    <div
                        class="el-table__header-wrapper"
                        style="max-height:400px; overflow: auto;"
                    >
                        <table
                            cellspacing="0"
                            cellpadding="0"
                            border="0"
                            class="el-table__header"
                            style="width: 100%;"
                        >
                            <tr style="background: #f4f7fa !important;">
                                <td class="is-center" style="padding:10px;font-weight: bold;font-size: 14px;">课程性质</td>
                                <td class="is-center" style="padding:10px;font-weight: bold;font-size: 14px;">子类别</td>
                                <td class="is-center" style="padding:10px;font-weight: bold;width: 80px;font-size: 14px;">学分</td>
                                <td class="is-center" style="padding:10px;font-weight: bold;font-size: 14px;">百分比%</td>
                                <td class="is-center" style="padding:10px;font-weight: bold;width: 280px;font-size: 14px;" colspan="2" v-if="!isRead">排序操作</td>
                            </tr>
                            <tr v-for="(row, $index) in processedData" v-if="row.labelId">
                                <td class="is-center" style="padding-left:10px;" v-if="row.show" :rowspan="row.pidRowSpan">{{row.name}}</td>
                                <td class="is-center" style="padding-left:10px;">
                                    <template>{{ row.subName }}</template>
                                </td>
                                <td class="is-center" style="width: 80px;padding-left:10px;">
                                     <template>
                                        <el-input
                                            v-if="!isRead && row.orderNo != 999"
                                            v-model="row.score"
                                            type="number"
                                            @focus="focusInput(row)"
                                            @blur="blurInput(row)"
                                            @change="changeInput()"
                                        />
                                        <span v-if="isRead">{{ row.score }}</span>
                                        <span v-if="row.orderNo == 999">{{ row.score }}</span>
                                    </template>
                                </td>
                                <td class="is-center" style="padding-left:10px;">
                                    <template
                                        v-if="row.labelId !== ''"
                                    >{{ getPercent(row) }}</template>
                                </td>
                                <td style="width: 140px;padding-left:10px;" v-if="!isRead">
                                    <template v-if="row.labelId !== ''">
                                        <el-button type="text" size="mini" @click="removeRow(row)">删除</el-button>
                                        <el-button
                                            v-if=" !!row.subName && row.subLength !== 1 && row.index !== 1"
                                            type="text"
                                            size="mini"
                                            @click="moveUp(row)"
                                        >上移</el-button>
                                        <el-button
                                            v-if="!!row.subName && row.subLength !== 1 && row.index != row.subLength"
                                            type="text"
                                            size="mini"
                                            @click="moveDown(row)"
                                        >下移</el-button>
                                    </template>
                                </td>
                                <td style="width: 140px;padding-left:10px;" v-if="row.show && !isRead" :rowspan="row.pidRowSpan">
                                    <template v-if="row.labelId !== ''">
                                        <el-button
                                            v-if="row.pindex != 1"
                                            type="text"
                                            size="mini"
                                            @click="moveUp(row, 1)"
                                        >上移</el-button>
                                        <el-button
                                            v-if="topCategoryLength != row.pindex"
                                            type="text"
                                            size="mini"
                                            @click="moveDown(row, 1)"
                                        >下移</el-button>
                                    </template>
                                </td>
                            </tr>
                            <tr v-for="(row, $index) in processedData" v-if="!row.labelId">
                                <td class="is-center" style="padding-left:10px;" v-if="row.show" :rowspan="row.pidRowSpan">{{row.name}}</td>
                                <td class="is-center" style="padding-left:10px;">
                                    <template>{{ row.subName }}</template>
                                </td>
                                <td class="is-center" style="width: 80px;padding-left:10px;">
                                     <template>
                                        <el-input
                                            v-if="!isRead && row.orderNo != 999"
                                            v-model="row.score"
                                            type="text"
                                            @focus="focusInput(row)"
                                            @blur="blurInput(row)"
                                        />
                                        <!-- <span v-if="isRead">{{ row.score }}</span>
                                        <span v-if="row.orderNo == 999">{{ row.score }}</span> -->
                                         <span v-if="isRead || row.orderNo == 999">{{ row.score }}</span>
                                    </template>
                                </td>
                                <td class="is-center" style="padding-left:10px;">
                                    <template
                                        v-if="row.labelId !== ''"
                                    >{{ getPercent(row) }}</template>
                                </td>
                                <td style="width: 140px;padding-left:10px;" colspan="2"  v-if="!isRead">
                                </td>
                            </tr>
                        </table>
                        <div class="el-table__empty-block" style="width: 100%;" v-if="!processedData.length"><span class="el-table__empty-text">暂无数据</span></div>
                    </div>
                </div>
            </div>
        </el-col>
        <el-row v-if="next" class="pd-12px float-right" style="padding-right: 0;">
            <el-col :span="24">
                <el-button size="medium" @click="backStep">上一步</el-button>
                <el-button v-if="!isRead" size="medium" @click="submit(null)">保存</el-button>
                <el-button size="medium" type="primary" @click="nextStep">下一步</el-button>
            </el-col>
        </el-row>

        <el-dialog
            :visible.sync="addCategoryVisible"
            :before-close="handleClose"
            :title="'添加课程分类'"
            width="34%"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
        >
            <!-- <el-card shadow="never" body-style="padding: 24px;"> -->
                <el-tree
                class="tree"
                :data="treeData"
                ref="tree"
                node-key="id"
                default-expand-all
                :default-checked-keys="checkedkeys"
                :expand-on-click-node="false">
                <span class="custom-tree-node" slot-scope="{node}">
                    <span>{{ node.label }}</span>
                    <span>
                        <el-checkbox v-model="node.checked" @change="changeCheck(node)"></el-checkbox>
                    </span>
                </span>
                </el-tree>
            <span slot="footer" class="dialog-footer">
                <el-button @click="cache">取 消</el-button>
                <el-button type="primary" @click="submitCourseCategory">确 定</el-button>
            </span>
        </el-dialog>
    </div>
</template>
<script>
import {
    saveCourseCategoryForm,
    getCourseCategoryFormById,
    coursesLabelTreeList,
    batchSaveCultureRule,
    findCheckedCultureLabelList,
    deleteCultureRule
} from "common/src/api/culture/bachelor";
// import { deleteCultureRule } from "common/src/api/culture/cultureSchemeRule";
import UTILS from "common/src/utils/utils";
import { queryDic } from "common/src/api/dictionary";
export default {
    name: "courseCategoryForm",
    props: {
        next: {
            type: Function,
            default: null
        },
        templateId: {
            type: Number,
            default: null
        },
        cultureId: {
            type: Number,
            default: null
        },
        isRead: {
            type: Boolean,
            default: false
        },
        dataType: {
            type: String,
            default: "1" // 1为模板，2为方案
        }
    },
    data() {
        let treeData = [];
        return {
            tip:
                '"课程性质"会自动关联到相应的学生，请教务员填写每个课程性质的最低学分要求。',
            resCategories: [], // 缓存返回的分类数据
            courseCategories: [], // 原始数据
            processedData: [], // 转换后数据
            courseCheckedData: [], // 课程选择
            courseCheckeds: [],
            topCategoryLength: 0,
            addCategoryVisible: false,
            queryForm: {
                trainingLevel: ""
            },
            options: {
                trainingLevel: [],
                labelTypes: []
            },
            checkedkeys:[]
        };
    },
    created() {
        this.getCourseCategory();
        this.initOptions();
    },
    mounted(){
        
    },
    methods: {
        changeCheck (node) {
            console.log('node')
            if (node.childNodes && node.childNodes.length) {
                node.childNodes.forEach(row => {
                    row.checked = node.checked;
                })
            }
            if(node.parent && node.parent.childNodes.length){
                let num = 0;
                node.parent.childNodes.forEach(row =>{
                    if(row.checked){
                        num++
                    }
                })
                if(num > 0){
                    node.parent.checked = true;
                }else{
                     node.parent.checked = false;
                }
            }
            console.log(node)

        },
        initOptions() {
            const data = {
                lang: this.$store.getters.language || "cn",
                type: "allChild",
                keys: ["X_PYCC", "K_KCLB"]
                
            };
            queryDic(data).then(res => {
                if (res.code === 200) {
                    UTILS.fillSelect(
                        {
                            trainingLevel: "X_PYCC",
                            labelTypes: "K_KCLB"
                        },
                        res.data,
                        this.options
                    );
                }
            });
        },
        // 输入框获取焦距
        focusInput(row) {
            if (row.score === 0) {
                row.score = "";
            }
        },
        // 输入框失去焦距
        blurInput(row) {
            if (row.score.trim() === "") {
                row.score = 0;
            }
            const value = Number(row.score);
            if (isNaN(value)) {
                row.score = 0;
            } else if (value < 0) {
                row.score = Math.abs(row.score);
            }
            // row.score = Math.floor(row.score); //处理小数
        },
        changeInput () {
            let totalScore = 0, totalIndex = null;
            this.processedData.forEach((row, index) => {
                if (row.labelId)
                totalScore += row.score * 1;
                if (!row.labelId)
                totalIndex = index;

            })
            this.processedData[totalIndex].score = totalScore;
        },
        cache(){
            this.addCategoryVisible=false,
            this.checkedkeys=[]
        },
        submit(callback) {
            if (this.processedData.length === 0) {
                this.$message({
                    type: "warning",
                    message: "请添加课程性质！"
                });
                return;
            }
            const data = {
                id: this.templateId,
                cultureRuleList: []
            };
            const totalScore = _.map(this.processedData, "score").reduce(
                function(total, num) {
                    return parseInt(total) + parseInt(num);
                }
            );
            const isTotalMax =
                parseInt(
                    this.processedData[this.processedData.length - 1].score
                ) >=
                totalScore -
                    parseInt(
                        this.processedData[this.processedData.length - 1].score
                    );
            if (!isTotalMax) {
                this.$message({
                    type: "warning",
                    message: "总学分必须大于等于所有课程学分的总和"
                });
                return;
            }
            console.log(this.resCategories)
            this.resCategories.forEach(row => {
                this.processedData.forEach(d =>{
                    if(d.id == row.id){
                        row.score = d.score
                    }
                })
            });
            this.resCategories.forEach(row => {
                data.cultureRuleList.push({
                    id: row.id,
                    labelId: row.labelId,
                    credit: row.score,
                    level: row.level,
                    type: this.dataType,
                    orderNo: row.index
                });
            });
            saveCourseCategoryForm(data).then(response => {
                if (response.code === 200) {
                    console.log(this.processedData)
                    this.resCategories.forEach(d=>{
                        this.processedData.forEach(e=>{
                        if(e.id == d.id){
                            d.credit = e.score
                        }
                    })
                    })
                    this.$message({
                        type: "success",
                        message: "保存成功"
                    });
                    if (callback) {
                        callback();
                    }
                }
            });
        },
        // 上一步
        backStep() {
            if (this.next) {
                this.next(-1);
            }
        },
        // 下一步
        nextStep() {
            if (this.isRead) {
                if (this.next) {
                    this.next();
                }
            } else {
                this.submit(() => {
                    if (this.next) {
                        this.next();
                    }
                });
            }
        },
        // 获取百分比
        getPercent(row) {
            const scoresArr = this.processedData.map(p => p.score);
            let totalScore = scoresArr.reduce((prev, curr, index) => {
                const value = Number(curr);
                if (!isNaN(value) && scoresArr.length !== index + 1) {
                    return Number(prev) + Number(curr);
                } else {
                    return Number(prev);
                }
            }, 0);

            if (isNaN(totalScore) || totalScore === 0) {
                totalScore = 1;
            }
            return ((parseFloat(row.score / totalScore).toFixed(4)) * 100).toFixed(2) + '%';
        },
        // 合计
        getSummaries(param) {
            const { columns, data } = param;
            const sums = [];
            columns.forEach((column, index) => {
                if (index === 0) {
                    sums[index] = "总计";
                    return;
                }
                if (index === 1 || index === 3) {
                    sums[index] = "";
                    return;
                }
                const values = data.map(item => Number(item[column.property]));
                sums[index] = values.reduce((prev, curr) => {
                    const value = Number(curr);
                    if (!isNaN(value)) {
                        return prev + curr;
                    } else {
                        return prev;
                    }
                }, 0);
            });
            return sums;
        },
        // 计算合并单元格
        arraySpanMethod({ row, column, rowIndex, columnIndex }) {
            if (columnIndex === 0) {
                if (row.isMixed) {
                    if (row.isFirst) {
                        return {
                            rowspan: row.subLength,
                            colspan: 1
                        };
                    } else {
                        return {
                            rowspan: 0,
                            colspan: 0
                        };
                    }
                }
            }
            if (columnIndex === 5) {
                if (row.isMixed) {
                    if (row.isFirst) {
                        return {
                            rowspan: row.subLength,
                            colspan: 1
                        };
                    } else {
                        return {
                            rowspan: 0,
                            colspan: 0
                        };
                    }
                }
            }
        },
        // 获取课程分类列表
        getCourseCategory() {
            getCourseCategoryFormById(this.templateId, this.dataType).then(
                response => {
                    if (response.code === 200) {
                        if (
                            response.data.cultureRuleList &&
                            response.data.cultureRuleList.length > 0
                        ) {
                            response.data.cultureRuleList.forEach(item=>{//标示是否为父级
                                if(item.parentId=='0'||item.parentId==''){
                                    item.level='1'
                                }else{
                                    item.level='2'
                                }
                            })
                            this.resCategories = response.data.cultureRuleList;
                            this.__fromatData(response.data.cultureRuleList);
                        }
                    }
                }
            );
        },
        // 转换原始数据为视图数据
       // 转换原始数据为视图数据
        __convert() {
            const largeCategories = this.courseCategories.filter(
                c => c.pid === "0"
            );
            const result = [];
            largeCategories.forEach(large => {
                const smallCategories = this.courseCategories.filter(
                    small => small.pid === large.labelId
                );
                // 是否存在子分类
                if (smallCategories.length > 0) {
                    let isFirst = true;
                    smallCategories.forEach(small => {
                        result.push({
                            id: small.id,
                            labelId: small.labelId,
                            name: large.name,
                            score: small.score,
                            subName: small.name,
                            level: small.level,
                            pid: large.labelId,
                            plevel: large.level,
                            isFirst: isFirst,
                            labelType: small.labelType,
                            subLength: smallCategories.length,
                            orderNo: small.orderNo,
                            index: small.index,
                            pindex: large.index,
                            isMixed: true // 包含子分类
                        });
                        isFirst = false;
                    });
                } else {
                    result.push({
                        id: large.id,
                        labelId: large.labelId,
                        level: large.level,
                        name: large.name,
                        score: large.score,
                        orderNo: large.orderNo,
                        index: large.index,
                        pindex: large.index,
                        labelType: large.labelType,
                        subName: ""
                    });
                }
            });
            var savePidRow = {}, savePidIndex = 0, totlaRow = {};
            result.forEach((row, index) => {
                row.pidRowSpan = 1;
                row.show = true;
                if (savePidRow) {
                    if(row.pid && row.pid === savePidRow.pid) {
                        result[savePidIndex].pidRowSpan ++;
                        delete row.pid;
                        row.show = false;
                    } else if (row.pid && row.pid !== savePidRow.pid){
                        savePidRow = row;
                        savePidIndex = index;
                        row.show = true;
                    }
                } else {
                    savePidRow = row;
                    savePidIndex = 0;
                    savePidIndex = 0;
                }
            })
            this.processedData = result;
            console.log(this.processedData)
        },
        // 格式化课程分类数据
        __fromatData(data) {
            this.topCategoryLength = data.filter(o => o.level === "1" && o.orderNo != "999").length;
            this.courseCategories.length = 0;
            data = _.sortBy(data, ["level","index", "orderNo"]);
            if (data && data.length > 0) {
                data.forEach(row => {
                    if (row.labelId) {
                        this.courseCategories.push({
                            id: row.id,
                            labelId: row.labelId,
                            level: row.level,
                            name: row.label,
                            pid: row.parentId?row.parentId:'0',
                            score: row.credit,
                            orderNo: row.orderNo,
                            labelType: row.labelType,
                            index: row.index
                        });
                    } else {
                        this.courseCategories.push({
                            id: row.id,
                            labelId: "",
                            name: "总学分",
                            pid: "0",
                            score: row.credit,
                            orderNo: row.orderNo,
                            index: row.index
                        });
                    }
                });
            } else if (data) {
                data.coursesLabelList.forEach(row => {
                    this.courseCategories.push({
                        id: row.id,
                        labelId: row.labelId,
                        name: row.label,
                        pid: row.parentId,
                        score: row.credit,
                        orderNo: row.orderNo,
                        labelType: row.labelType,
                        index: row.index
                    });
                });
            }
            this.__convert();
        },
        // 获取所有课程类别（树形）
        getAllCourseCategorys() {
            const params = {
                templateId: this.templateId
            };
            coursesLabelTreeList(params).then(res => {
                if (res && res.code === 200) {
                    let data = res.data.map(item => {
                        return {
                            id: item.labid,
                            label:
                                "en" === this.$store.getters.language
                                    ? item.nameen
                                    : item.namecn,
                            parentID: item.parentid,
                            labtype:item.labtype,
                        };
                    });
                   
                    
                    this.courseCheckedData = data;
                    this.treeData = this.setTree(data);
                    this.addCategoryVisible = true;
                }
            });
            const param={
                taringingId: this.templateId,
                type: "1"
            };
            findCheckedCultureLabelList(param).then(res =>{
            //    let CheckedCategorys=res.data.forEach(item =>{
            //        this.checkedkeys.push(item.labelId)
            //    })
            this.checkedkeys=[];
              res.code ==200 && res.data.forEach(item=>this.checkedkeys.push(item.labelId))
           })
           console.log(this.checkedkeys)
            

        },
        setTree(data) {
            let parent = data.filter(item => {
                return (item.parentID == null||item.parentID == 0);
            });
            let child = data.filter(item => {
                return item.parentID >0;
            });
            if (child.length > 0) {
                parent.forEach(par => {
                    par.children = [];
                    child.forEach(chi => {
                        if (par.id == chi.parentID) {
                            chi.courseType=chi.parentID;
                            par.children.push(chi);
                        }
                    });
                });
            }
            return parent;
        },
        addCourseCategory() {
            this.getAllCourseCategorys();
        },
        __getCheckedNodes() {
            if (this.courseCheckeds.length == 0) {
                this.$message({ type: "warning", message: "请选择课程性质" });
                return;
            }
            let param=this.courseCheckeds.map(item=>{
                return{
                    labelId:item,
                    type:this.dataType
                 }
            })
            const data = {
                id: this.templateId,
                cultureRuleList: param
            };
            batchSaveCultureRule(data).then(res => {
                if (res.code === 200) {
                    this.addCategoryVisible = false;
                    
                    this.getCourseCategory();
                }
            });
        },
        submitCourseCategory() {
            this.courseCheckeds=this.$refs.tree.getCheckedKeys();
            console.log(this.courseCheckeds)
            this.__getCheckedNodes();
            this.checkedkeys=[];
        },
        // removeRow(row) {
        //     const params = {
        //         id: row.id
        //     };
        //     this.$confirm(
        //         this.$t("common.tips.beSure"),
        //         this.$t("common.text.info"),
        //         {
        //             confirmButtonText: this.$t("common.btn.confirm"),
        //             cancelButtonText: this.$t("common.btn.cancel"),
        //             type: "warning"
        //         }
        //     ).then(() => {
        //         let isOnlySubCategory = false;
        //         if (row.level == 2) {
        //             isOnlySubCategory = this.resCategories.filter( e => e.parentId === row.pid).length === 1;
        //         }
        //         deleteCultureRule(params).then(res => {
        //             if (res.code === 200) {
        //                 if (isOnlySubCategory) {
        //                     //删除父类
        //                     let parentCategory = this.resCategories.find(e => e.labelId === row.pid);
        //                     if (parentCategory) {
        //                         deleteCultureRule({id: parentCategory.id}).then(result => {
        //                             if (result.code === 200) {
        //                                 this.processedData = []
        //                                 this.$message({
        //                                     type: "success",
        //                                     message: this.$t("common.tips.deleteSuccess")
        //                                 });
        //                             }
        //                         })
        //                     }   

        //                 } else {
        //                     this.getCourseCategory();
        //                     this.$message({
        //                         type: "success",
        //                         message: this.$t("common.tips.deleteSuccess")
        //                     });
        //                 }
        //             }
        //         });
                
        //     });
        // },
        removeRow(row) {
            const params = {
                id: row.id
            };
            this.$confirm(
                this.$t("common.tips.deleteTips"),
                    "提示",
                {
                    confirmButtonText: this.$t("common.btn.confirm"),
                    cancelButtonText: this.$t("common.btn.cancel"),
                    type: "warning"
                }
            ).then(() => {
                let isOnlySubCategory = false;
                if (row.level == 2) {
                    isOnlySubCategory = this.resCategories.filter( e => e.parentId === row.pid).length === 1;
                }
                deleteCultureRule(params).then(res => {
                    if (res.code === 200) {
                        if (isOnlySubCategory) {
                            //删除父类
                            let parentCategory = this.resCategories.find(e => e.labelId === row.pid);
                            if (parentCategory) {
                                deleteCultureRule({id: parentCategory.id}).then(result => {
                                    if (result.code === 200) {
                                        this.processedData = []
                                        this.getCourseCategory();
                                        this.$message({
                                            type: "success",
                                            message: this.$t("common.tips.deleteSuccess")
                                        });
                                    }
                                })
                            }   

                        } else {
                            this.getCourseCategory();
                            this.$message({
                                type: "success",
                                message: this.$t("common.tips.deleteSuccess")
                            });
                        }
                    }
                });
                
            });
        },
        moveUp(row, flag) {
            let currentItemIndex = -1;
            let targetItemIndex = -1;
            console.log(this.resCategories)
            if (flag) {
                const pid = row.pid ? row.pid : row.labelId;
                currentItemIndex = _.findIndex(this.resCategories, {
                    labelId: pid
                });
                targetItemIndex = _.findIndex(this.resCategories, {
                    level:this.resCategories[currentItemIndex].level,
                    index:
                        parseInt(this.resCategories[currentItemIndex].index) - 1
                });
            } else {
                currentItemIndex = _.findIndex(this.resCategories, {
                    labelId: row.labelId
                });
                targetItemIndex = _.findIndex(this.resCategories, {
                    parentId: this.resCategories[currentItemIndex].parentId,
                    level: this.resCategories[currentItemIndex].level,
                    index:
                        parseInt(this.resCategories[currentItemIndex].index) - 1
                });
            }
            if (currentItemIndex !== -1 && targetItemIndex !== -1) {
                this.resCategories[targetItemIndex].index =
                    parseInt(this.resCategories[targetItemIndex].index) + 1;
                this.resCategories[currentItemIndex].index =
                    parseInt(this.resCategories[currentItemIndex].index) - 1;
                this.__fromatData(this.resCategories);
                console.log(this.resCategories)
            }
            //this.submit();
        },
        moveDown(row, flag) {
            let currentItemIndex = -1;
            let targetItemIndex = -1;
            if (flag) {
                const pid = row.pid ? row.pid : row.labelId;
                currentItemIndex = _.findIndex(this.resCategories, {
                    labelId: pid
                });
                targetItemIndex = _.findIndex(this.resCategories, {
                    level: this.resCategories[currentItemIndex].level,
                    index:
                        parseInt(this.resCategories[currentItemIndex].index) + 1
                });
            } else {
                currentItemIndex = _.findIndex(this.resCategories, {
                    labelId: row.labelId
                });
                targetItemIndex = _.findIndex(this.resCategories, {
                    parentId: this.resCategories[currentItemIndex].parentId,
                    level: this.resCategories[currentItemIndex].level,
                    index:
                        parseInt(this.resCategories[currentItemIndex].index) + 1
                });
            }
            if (currentItemIndex !== -1 && targetItemIndex !== -1) {
                this.resCategories[targetItemIndex].index =
                    parseInt(this.resCategories[targetItemIndex].index) - 1;
                this.resCategories[currentItemIndex].index =
                    parseInt(this.resCategories[currentItemIndex].index) + 1;
                this.__fromatData(this.resCategories);
            }
            //this.submit();
        },
        // handleSelectionChange(checkeds) {
        //     const self = this;
        //     self.courseCheckeds = [];
        //     if (checkeds.length === 0) return;
        //     _.forEach(checkeds, item => {
        //         if (item) {
        //             if (item.pid) {
        //                 self.courseCheckeds.push({
        //                     labelId: item.pid,
        //                     level: item.plevel,
        //                     type: this.dataType
        //                 });
        //             }
        //             self.courseCheckeds.push({
        //                 labelId: item.id,
        //                 level: item.level,
        //                 labelType: item.labelType || 0,
        //                 type: this.dataType
        //             });
        //         }
        //     });
        //     self.courseCheckeds = _.unionBy(self.courseCheckeds, "labelId");
        // },
        // handleLabelTypeChange(item) {
        //     let changeItem = _.find(this.courseCheckeds, {
        //         labelId: item.id
        //     });
        //     changeItem && (changeItem.labelType = item.labelType);
        // }
    }
};
</script>
<style lang="scss" scoped>
.el-table th{
    border-right: none!important;
    
}
.tip-message {
    margin: 10px 0;
    font-size: 14px;
    color: #909090;
}
.custom-tree-node {
    flex: 1;
    display: flex;
    align-items: center;
    height: 40px;
    justify-content: space-between;
    font-size: 14px;
    padding-right: 8px;
  }
</style>
